<?php
/**
 *
 * Storage.php
 *
 * Author: jinxing.liu
 * Create: 2019-06-11 09:56
 * Editor: created by PhpStorm
 */

namespace Jinxing\Admin\Helpers;

class Storage
{
    /**
     * @var array 数据信息
     */
    private static $data = [];

    /**
     * 设置数据
     *
     * @param string $key   数据key
     * @param mixed  $value 数据值
     *
     * @return mixed
     */
    static public function set($key, $value)
    {
        return static::$data[$key] = $value;
    }

    /**
     * 获取数据
     *
     * @param string $key
     * @param null   $default
     *
     * @return mixed|null
     */
    static public function get($key, $default = null)
    {
        return Helper::getValue(static::$data, $key, $default);
    }

    /**
     * 删除数据
     *
     * @param $key
     */
    static public function delete($key)
    {
        unset(static::$data[$key]);
    }
}